package com.acce.gxsc.page.inCarDetail.editInCarDetail;

import com.acce.gxsc.model.WorkModel;
import com.acce.gxsc.model.loaclBean.ResultBean;
import com.acce.sdk.base.mvp.BasePresenter;
import com.acce.sdk.utils.LogUtils;
import com.acce.sdk.utils.ToastUtils;

import rx.Subscriber;

/**
 * Created by zxChor on 2017/11/10.
 */

public class EditInCarDetailPresenter extends BasePresenter<EditInCarDetailView> {

    public void editCar(String inCarKey,String plateNum,String hangNum,String contactName){

        WorkModel.getInstance().editCar(inCarKey,plateNum,hangNum,contactName).subscribe(new Subscriber<ResultBean<Object>>() {
            @Override
            public void onStart() {
                if(mViewRef!=null){
                    getView().showProgressDialog("加载中...",false);
                }
            }

            @Override
            public void onCompleted() {
                if(mViewRef!=null){
                    getView().hideProgressDialog();
                }
            }

            @Override
            public void onError(Throwable e) {
                if(mViewRef!=null){
                    getView().hideProgressDialog();
                }
            }

            @Override
            public void onNext(ResultBean<Object> objectResultBean) {
                    if(mViewRef!=null){
                        ToastUtils.show("修改成功");
                    }
            }
        });
    }
}
